package demo.spring.framework.boot.web.servlet;

import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;

import demo.javax.servlet.http.HelloWorldServlet;

public class ServletRegistrationBeanDemo {

    @Bean
    public ServletRegistrationBean<HelloWorldServlet> servletRegistrationBean() {
        ServletRegistrationBean<HelloWorldServlet> servletBean = new ServletRegistrationBean<>();

        servletBean.setServlet(new HelloWorldServlet());
        servletBean.addUrlMappings("/contextpath/healthcheck");
        servletBean.setLoadOnStartup(1);
        servletBean.setOrder(ServletRegistrationBean.HIGHEST_PRECEDENCE);
        return servletBean;
    }
}
